﻿using System;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEditor;
using UnityEngine;

namespace IQIGame.Onigao.GamePlay.Editors
{
    [CreateAssetMenu(fileName = "SkillEditorCustomSetting", menuName = "Create Scriptable Config/技能编辑器/技能编辑自定义状态类型")]
    public class SkillEditorCustomSetting : SerializedScriptableObject
    {
        public Dictionary<string, SkillEditorCustomConfig> customStr = new Dictionary<string, SkillEditorCustomConfig>();
    }

    [Serializable]
    public class SkillEditorCustomConfig
    {
        public List<string> str = new List<string>();
    }

    public static class SkillEditorCustomSettingGlobal
    {
        public static SkillEditorCustomSetting setting;

        public static SkillEditorCustomConfig GetConfig(string key)
        {
            if (setting == null)
            {
                setting = AssetDatabase.LoadAssetAtPath<SkillEditorCustomSetting>("Assets/EditorConfig/SkillConfig/SkillEditorCustomSetting.asset");
            }
            if (setting.customStr.TryGetValue(key, out var rConfig))
            {
                return rConfig;
            }
            return null;
        }
    }
}